import os
from datetime import datetime, timedelta, timezone

all_product_kuang = set()
all_img_plc_kuang = set()
all_img_kuang = set()
all_img_upload = set()
all_img_db = set()


f=open('db_product_id.txt', encoding='utf-8')
#此时只读取了一行
pre = f.readline()
pre = pre.replace("\n","")
all_product_kuang.add(pre)
while pre:
    next_line = f.readline()
    next_line = next_line.replace("\n", "")
    all_product_kuang.add(next_line)
    pre = next_line
f.close()
print(f"------all_product_kuang: {len(all_product_kuang)}")

f0=open('plc_kuang_img_11.txt', encoding='utf-8')
#此时只读取了一行
pre = f0.readline()
pre = pre.replace("\n","")
all_img_plc_kuang.add(pre)
while pre:
    next_line = f0.readline()
    next_line = next_line.replace("\n", "")
    all_img_plc_kuang.add(next_line)
    pre = next_line
f0.close()
print(f"------all_img_plc_kuang: {len(all_img_plc_kuang)}")

f1=open('kuang_img_11.txt', encoding='utf-8')
#此时只读取了一行
pre = f1.readline()
pre = pre.replace("\n","")
all_img_kuang.add(pre)
while pre:
    next_line = f1.readline()
    next_line = next_line.replace("\n", "")
    all_img_kuang.add(next_line)
    pre = next_line
f1.close()
print(f"------all_img_kuang: {len(all_img_kuang)}")

f2=open('upload_img_11.txt', encoding='utf-8')
#此时只读取了一行
pre = f2.readline()
pre = pre.replace("\n","")
all_img_upload.add(pre)
while pre:
    next_line = f2.readline()
    next_line = next_line.replace("\n", "")
    all_img_upload.add(next_line)
    pre = next_line
f2.close()
print(f"------all_img_upload: {len(all_img_upload)}")

f3=open('db_img_11.txt', encoding='utf-8')
#此时只读取了一行
pre = f3.readline()
pre = pre.replace("\n","")
all_img_db.add(pre)
while pre:
    next_line = f3.readline()
    next_line = next_line.replace("\n", "")
    all_img_db.add(next_line)
    pre = next_line
f3.close()
print(f"------all_img_db: {len(all_img_db)}")

print(f"-----all_img_kuang:{all_img_kuang}")
print(f"-----all_img_upload:{all_img_upload}")
print(f"-----all_img_db:{all_img_db}")

loss = set()
for item in all_product_kuang:
    if item not in all_img_plc_kuang:
        loss.add(item)
print(f"-----loss:{loss}")


loss_0 = set()
loss_0_1 = set()
for item in all_img_plc_kuang:
    if item not in all_img_kuang:
        loss_0_1.add(item)
    if item not in all_img_db:
        loss_0.add(item)
print(f"-----loss_0:{loss_0}")
print(f"-----loss_0_1:{loss_0_1}")

loss_1 = set()
loss_2 = set()
for item in all_img_kuang:
    if item not in all_img_upload:
        loss_1.add(item)
    if item not in all_img_db:
        loss_2.add(item)

print(f"-----loss_1:{loss_1}")
print(f"-----loss_2:{loss_2}")

loss_3 = set()
for item in all_img_upload:
    if item not in all_img_db:
        loss_3.add(item)

print(f"-----loss_3:{loss_3}")



all_pad_inspect_id = set()
f5=open('pad_inspect_0620.txt', encoding='utf-8')
#此时只读取了一行
pre = f5.readline()
pre = pre.replace("\n","")
pre = pre.replace(" ","")
all_pad_inspect_id.add(int(pre))
while pre:
    next_line = f5.readline()
    next_line = next_line.replace("\n", "")
    next_line = next_line.replace(" ", "")
    if next_line:
        all_pad_inspect_id.add(int(next_line))
    pre = next_line
f5.close()
print(f"-----all_pad_inspect_id:{sorted(all_pad_inspect_id)}")

loss_6 = list()
for item in range(16104 ,17432):
    if item not in all_pad_inspect_id:
        loss_6.append(item)
print(f"-----loss_6:{loss_6}")
